package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.domain.ExinspInsedJoint;
import com.deyuanyun.pic.ctrl.enumeration.AbnormalEnum;
import com.deyuanyun.pic.ctrl.enumeration.MountingClassEnum;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

/**
 * 绝缘装置检测记录表
 */
public class ExinspInsedJointVO extends ExinspBaseVO<ExinspInsedJoint> {

    // 管道名称
    private String pipeLineName;
    // 设备编号(自定义编号)
    private String customNumber;
    // 测试桩编号
    private String testStationNum;
    // 所属场站阀室
    private String pipeValveroomNanme;
    // 位置描述
    private String lacationDescription;
    // 安装类别（埋地、地上）
    private String mountingClass;
    // 安装位置（场站阀室名称、其它）
    private String installationsite;
    // 电位法测试_站内侧管/地电位（mV）
    public Long nonProtectivePotential;
    // 电位法测试_站外侧管/地电位（mV）
    public Long protectivePotential;
    // PCM漏电率测试_站外侧管内电流（mA）
    public Long externalCurrent;
    // PCM漏电率测试_站内侧管内电流（mA）
    public Long innerCurrent;
    // 异常记录
    private String faultRecord;
    // 是否有异常(YES、NO)
    private String abnormal;
    // 处理措施
    private String treatmentMeasures;
    // 检测日期
    private String detectiongDete;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getTestStationNum() {
        return testStationNum;
    }

    public void setTestStationNum(String testStationNum) {
        this.testStationNum = testStationNum;
    }

    public String getPipeValveroomNanme() {
        return pipeValveroomNanme;
    }

    public void setPipeValveroomNanme(String pipeValveroomNanme) {
        this.pipeValveroomNanme = pipeValveroomNanme;
    }

    public String getLacationDescription() {
        return lacationDescription;
    }

    public void setLacationDescription(String lacationDescription) {
        this.lacationDescription = lacationDescription;
    }

    public String getMountingClass() {
        return mountingClass;
    }

    public void setMountingClass(String mountingClass) {
        this.mountingClass = mountingClass;
    }

    public String getInstallationsite() {
        return installationsite;
    }

    public void setInstallationsite(String installationsite) {
        this.installationsite = installationsite;
    }

    public Long getNonProtectivePotential() {
        return nonProtectivePotential;
    }

    public void setNonProtectivePotential(Long nonProtectivePotential) {
        this.nonProtectivePotential = nonProtectivePotential;
    }

    public Long getProtectivePotential() {
        return protectivePotential;
    }

    public void setProtectivePotential(Long protectivePotential) {
        this.protectivePotential = protectivePotential;
    }

    public Long getExternalCurrent() {
        return externalCurrent;
    }

    public void setExternalCurrent(Long externalCurrent) {
        this.externalCurrent = externalCurrent;
    }

    public Long getInnerCurrent() {
        return innerCurrent;
    }

    public void setInnerCurrent(Long innerCurrent) {
        this.innerCurrent = innerCurrent;
    }

    public String getFaultRecord() {
        return faultRecord;
    }

    public void setFaultRecord(String faultRecord) {
        this.faultRecord = faultRecord;
    }

    public String getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(String abnormal) {
        this.abnormal = abnormal;
    }

    public String getTreatmentMeasures() {
        return treatmentMeasures;
    }

    public void setTreatmentMeasures(String treatmentMeasures) {
        this.treatmentMeasures = treatmentMeasures;
    }

    public String getDetectiongDete() {
        return detectiongDete;
    }

    public void setDetectiongDete(String detectiongDete) {
        this.detectiongDete = detectiongDete;
    }

    public void fromDomain(ExinspInsedJoint domain) {

        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getCreateRemark());
        // 设备编号(自定义编号)
        this.customNumber = domain.getCustomNumber();
        // 测试桩编号
        this.testStationNum = domain.getTestStationId();
        // 所属场站阀室
        this.pipeValveroomNanme = PipeLineUtil.getValveRoomName(domain.getPipeValveroomId());
        // 位置描述
        this.lacationDescription = domain.getLacationDescription();
        // 安装类别（埋地、地上）
        this.mountingClass = MountingClassEnum.getLabel(domain.getMountingClass());
        // 安装位置（场站阀室名称、其它）
        this.installationsite = domain.getInstallationsite();
        // 电位法测试_站内侧管/地电位（mV）
        this.nonProtectivePotential = domain.getNonProtectivePotential();
        // 电位法测试_站外侧管/地电位（mV）
        this.protectivePotential = domain.getProtectivePotential();
        // PCM漏电率测试_站外侧管内电流（mA）
        this.externalCurrent = domain.getExternalCurrent();
        // PCM漏电率测试_站内侧管内电流（mA）
        this.innerCurrent = domain.getInnerCurrent();
        // 异常记录
        this.faultRecord = domain.getFaultRecord();
        // 是否有异常(YES、NO)
        this.abnormal = AbnormalEnum.getLabel(domain.getAbnormal());
        // 处理措施(分到其他表中，暂时还不知道如何处理)
        this.treatmentMeasures = domain.getUpdateRemark();;
        // 检测日期
        this.detectiongDete = DateFormat.format(domain.getDetectiongDete());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspInsedJointVO> fromDomainList(Page<ExinspInsedJoint> domainList) {

        Page<ExinspInsedJointVO> list = new Page<ExinspInsedJointVO>();
        for (ExinspInsedJoint exinspInsedJoint : domainList) {
            ExinspInsedJointVO exinspInsedJointVO = new ExinspInsedJointVO();
            exinspInsedJointVO.fromDomain(exinspInsedJoint);
            list.add(exinspInsedJointVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}